ihelpuoo.namespace("ihelpuoo.widget.list");

ihelpuoo.widget.list.SearcherView = function(gasket,patternName,fieldsMapping)
{
	this.view = new ihelpuoo.widget.View(gasket,patternName);
	this.mapping = (fieldsMapping?fieldsMapping.split(","):new Array("keyword"));
}

ihelpuoo.widget.list.SearcherView.prototype
=
{
	getPostString: function()
	{
		var re = "";
		for(var i=0;i<this.mapping.length;i++)
		{
			var key = this.mapping[i];
			var v = this.view.trimString(key);
			this.view.set(key,v);
			if(!ihelpuoo.isBlank(v))
				re += "&" + key + "=" + encodeURIComponent(v);
		}
		if(re.length>0)
			return re.substring(1);
		return null;
	}
	
	,
	clear: function()
	{
		for(var i=0;i<this.mapping.length;i++)
		{
			this.view.set(this.mapping[i],"");
		}
	}
	
	// <WEBOO:INHERIT extends="ihelpuoo.widget.View">
	,draw: function(obj){this.view.draw(obj);}
	,getElement: function(key){return this.view.getElement(key);}
	,isNeverBeDrawn: function(){return this.view.isNeverBeDrawn();}
	,preparePattern: function(){this.view.preparePattern();}
	,display: function(){this.view.display();}
	,hide: function(){this.view.hide();}
	,set: function(key,value){this.view.set(key,value);}
	,getString: function(key,defValue){return this.view.getString(key,defValue);}
	,getInt: function(key,defValue){return this.view.getInt(key,defValue);}
	,getBoolean: function(key,defValue){return this.view.getBoolean(key,defValue);}
	,addEvent: function(key,eventName,fnHandler,bCapture){this.view.addEvent(key,eventName,fnHandler,bCapture);}
	,removeEvent: function(key,eventName,fnHandler,bCapture){this.view.removeEvent(key,eventName,fnHandler,bCapture);}
	// </WEBOO:INHERIT>
}